#include "HiranipraShared.h"

#include "Math/Point.h"
#include "Math/Size.h"

#ifndef _SHARED_PLATFORM_IWINDOW_H_
#define _SHARED_PLATFORM_IWINDOW_H_

namespace Hiranipra {
	namespace Platform {
		using namespace Hiranipra::Math;

		enum WindowState
		{
			Normal,
			Maximized,
			Minimized,
		};

		typedef struct WindowParameters_t
		{
			wstring		DefaultTitle;
			Size2D		DefaultSize;
			WindowState	DefaultState;
		} WindowParameters;

		class WindowEvent;
		typedef void* WindowHandle;

		class IWindow : implements RefInstance
		{
		public:
			virtual ~IWindow(){}

			virtual void SetTitle( const wstring& newTitle ) = 0;

			virtual uint32 GetCurrentDisplay() const = 0;
			virtual void MoveToDisplay( const uint32 displayId ) = 0;

			virtual Point2D GetLocation() const = 0;
			virtual void SetLocation( const float x, const float y ){ this->SetLocation( Point2D( x, y ) ); }
			virtual void SetLocation( const Point2D& location ) = 0;
			virtual Size2D GetSize() const = 0;
			virtual void SetSize( const float width, const float height ){ this->SetSize( Size2D( width, height ) ); }
			virtual void SetSize( const Size2D& size ) = 0;

			virtual WindowState GetState() const = 0;
			virtual void SetState( const WindowState state ) = 0;
			virtual bool IsMinimized() const = 0;
			virtual bool IsClosed() const = 0;
			virtual void Close() = 0;

			virtual WindowHandle GetHandle() const = 0;

		public:
			EventSource<WindowEvent>	EventSource;
		};

		class WindowEvent : public Event
		{
		public:
			enum WindowEventName
			{
				SizeChanged,
				Closed,
			};
		public:
			WindowEvent( IWindow* window, WindowEventName name ) :
				Event( name ),
				Window( window )
			{
				this->Window->Retain();
			}
			virtual ~WindowEvent()
			{
				RELEASE( this->Window );
			}
		public:
			IWindow*	Window;
		};

	}
}

#endif // _SHARED_PLATFORM_IWINDOW_H_
